/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
 var findBottomLeftValue = function(root) {
  function getBlV(node, depth) {
      let val = node.val;
      let dep = depth;
      if(node.left) {
          [val, dep] = getBlV(node.left, depth + 1);
      }
      if(node.right) {
          const [rl, rd] = getBlV(node.right, depth + 1);
          return rd > dep ? [rl, rd] : [val, dep];
      }
      return [val, dep];
  }
  return getBlV(root, 0)[0];
};